package com.itheima.pattern.visitor.doublefenpai;

public class Animal {
    public void accept(Execute exe){
        exe.execute(this);
    }
}

class Dog extends Animal{
    public void accept(Execute exe){
        exe.execute(this);
    }
}

class Cat extends Animal{
    public void accept(Execute exe){
        exe.execute(this);
    }
}

class Execute{
    public void execute(Animal a){
        System.out.println("动物");
    }

    public void execute(Dog d){
        System.out.println("狗");
    }

    public void execute(Cat c){
        System.out.println("猫");
    }
}